package com.nomi.blog.controller;

import com.nomi.blog.entity.UserInfo;
import com.nomi.blog.service.UserInfoService;
import com.nomi.blog.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/userInfo")
public class UserInfoController {
    @Autowired
    private UserInfoService userInfoService;

    @PostMapping("/create")
    public Result createUserInfo(@RequestBody UserInfo userInfo) {
        return userInfoService.createUserInfo(userInfo);
    }

    @PutMapping("/update")
    public Result updateUserInfo(@RequestBody UserInfo userInfo) {
        return userInfoService.updateUserInfo(userInfo);
    }

    /**
     * 获取用户信息
     * @param userId
     * @return
     */
    @GetMapping("/get/{userId}")
    public Result getUserInfo(@PathVariable Long userId) {
        return userInfoService.getUserInfo(userId);
    }
}
